package rsj.domain;

public class PageQuery {

    private static final int PAGE_COUNT = 20;
    private long pageCount;
    private int pageSize;
    private long offset;
    private long limit;

    public long getPageCount() {
        if (pageCount <= 0) {
            pageCount = 1;
        }
        return (pageCount - 1) * pageSize;
    }

    public void setPageCount(long pageCount) {
        this.pageCount = pageCount;
    }

    public int getPageSize() {
        if (pageSize <= 0) {
            pageSize = PAGE_COUNT;
        }
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public long getOffset() {
        return getPageCount();
    }

    public long getLimit() {
        return getPageSize();
    }
}
